﻿using System;
using System.CodeDom;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace InhVsCoup
{
    interface ILogger
    {
        void LogInfo(string message);
        void LogError(string message);
    }

    class FileLogger : ILogger
    {
        private readonly string _path;

        public FileLogger(string path)
        {
            _path = path;
        }

        public void LogInfo(string message)
        {
            Log(message, "Info");

        }

        public void LogError(string message)
        {
            Log(message, "Error");
        }

        private void Log(string message, string messageType)
        {
            using (StreamWriter writer = new StreamWriter(_path, true))
            {
                writer.WriteLine(messageType+ " " + message + " : " + DateTime.Now);
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            ILogger logger = new FileLogger(@"C:\My Files\log.txt");
            VacationCalculator vc = new VacationCalculator(logger);
            vc.CalculateAviableDays();
            MailServer ms = new MailServer(logger);
            ms.SendEmails(null, "Привет");
        }
    }
}
